package com.juyu.miliao.common.constant;

import lombok.Getter;

/**
 * 社区rediskey
 *
 * @author xuanqicheng
 * @create 2019-21-10:02
 */
public interface DynamicInfoRedisKey {
    /**
     * 查询社区集合分页key的集合
     */
    enum QuertDynamicInfoKeySet{
        /**
         * 查询社区集合分页key的集合
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "QuertDynamicInfoKeySet",
                "查询社区集合分页key的集合");

        private String key;

        @Getter
        private String message;

        QuertDynamicInfoKeySet(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(){
            return String.format(REDIS_KEY.key);
        }
    }


    /**
     * 分页查询动态
     */
    enum DynamicInfoListByPage{
        /**
         * 分页查询动态
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicInfoListByPage:%s:%s",
                "分页查询动态");

        private String key;

        @Getter
        private String message;

        DynamicInfoListByPage(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(int page,int pageSize){

            return String.format(REDIS_KEY.key,page,pageSize);
        }
    }

    enum DynamicInfoListByUserIdAndPage{
        /**
         * 根据userId,查询动态列表
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicInfoListByUserIdAndPage:%s",
                "根据userId,查询动态列表"),

        HASH_REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "Page:%s:%s",
                "根据userId,查询动态列表");

        private String key;

        @Getter
        private String message;

        DynamicInfoListByUserIdAndPage(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long userId){

            return String.format(REDIS_KEY.key,userId);
        }

        public String getHashKey(int page,int pageSize){

            return String.format(HASH_REDIS_KEY.key,page,pageSize);
        }
    }

    enum DynamicInfoListByFollowUser{

        /**
         * 根据userId,查询动态列表
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicInfoListByFollowUser:%s",
                "根据关注用户,查询动态列表"),

        HASH_REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "Page:%s:%s",
                "根据关注用户,查询动态列表，hash key");
        private String key;

        @Getter
        private String message;

        DynamicInfoListByFollowUser(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long userId){

            return String.format(REDIS_KEY.key,userId);
        }

        public String getHashKey(int page,int pageSize){

            return String.format(HASH_REDIS_KEY.key,page,pageSize);
        }

    }

    /**
     * 根据动态id,查询对应动态
     */
    enum DynamicInfoByDynamicId{
        /**
         * 根据动态id,查询对应动态
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicInfoByDynamicId:%s",
                "根据动态id,查询对应动态");

        private String key;

        @Getter
        private String message;

        DynamicInfoByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }
    }
    /**
     * 根据动态id,查询对应资源信息
     */
    enum DynamicSourceInfoByDynamicId{
        /**
         * 根据动态id,查询对应资源信息
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicSourceByDynamicId:%s",
                "根据动态id,查询对应资源信息");

        private String key;

        @Getter
        private String message;

        DynamicSourceInfoByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }
    }


    /**
     * 根据动态id,查询对应点赞数
     */
    enum DynamicLikeInfoByDynamicId{
        /**
         * 根据动态id,查询对应点赞数
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicLikeInfoByDynamicId:%s",
                "根据动态id,查询对应点赞数"),

        USER_INFO(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicLikeInfoByUser:%s:%s",
                "更加动态id，查询用户是否点赞");

        private String key;

        @Getter
        private String message;

        DynamicLikeInfoByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }

        public String getUserKeyFormat(long dynamicId,long userId){

            return String.format(USER_INFO.key,dynamicId,userId);
        }
    }

    /**
     * 根据动态id,查询对应礼物信息
     */
    enum DynamicGiftInfoByDynamicId{
        /**
         * 根据动态id,查询对应点赞数
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicGiftInfoByDynamicId:%s",
                "根据动态id,查询对应礼物信息");

        private String key;

        @Getter
        private String message;

        DynamicGiftInfoByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }
    }

    /**
     * 根据动态id,查询对应送礼物的人（去重）
     */
    enum DynamicGiftInfoUserIdByDynamicId{
        /**
         * 根据动态id,查询对应送礼物的人（去重）
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicGiftInfoUserIdByDynamicId:%s",
                "根据动态id,查询对应送礼物的人（去重）");

        private String key;

        @Getter
        private String message;

        DynamicGiftInfoUserIdByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }
    }

    enum DynamicInfoShareByDynamicId{
        /**
         * 根据动态id,查询对应点赞数
         */
        REDIS_KEY(RedisKeyPrefix.MI_LIAO_API_KEY + "DynamicInfoShareByDynamicId:%s",
                "根据动态id,查询对应分享次数");

        private String key;

        @Getter
        private String message;

        DynamicInfoShareByDynamicId(String key, String message) {
            this.key = key;
            this.message = message;
        }

        public String getKeyFormat(long dynamicId){

            return String.format(REDIS_KEY.key,dynamicId);
        }
    }
}
